from redis import  StrictRedis

class Config:
    DEBUG = None
    #数据库配置
    SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:root@localhost/rent21'
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    #状态保持
    SECRET_KEY = 'MC42Mjc0Njc1NzE1ODk2NzM3Cg=='
    SESSION_TYPE = 'redis'
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379
    SESSION_REDIS = StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    SESSION_USE_SIGNER = True
    PERMANENT_SESSION_LIFETIME = 86700

#定义开发模式下的配置类
class DevelopmentConfig(Config):
    DEBUG = True

#定义生产模式下的配置类
class ProductionConfig(Config):
    DEBUG = False

#定义字典实现动态加载不同配置类
config_dict = {
    'development' : DevelopmentConfig,
    'production': ProductionConfig
}